﻿using Huirui.Cavan.Domain.Seedwork;
using System;
using System.Collections;
using Huirui.Cavan.Domain.MainBoundedContext.SalesModule;
using Huirui.Cavan.Domain.MainBoundedContext.PurchaseModule;
using Huirui.Cavan.Domain.MainBoundedContext.StockModule;
using System.Collections.Generic;

namespace Huirui.Cavan.Domain.MainBoundedContext.SystemModule
{
    #region Project

    /// <summary>
    /// Project object for NHibernate mapped table 'Project'.
    /// </summary>
    [Serializable]
    public class Project : Persistent<string>
    {
        #region Member Variables

        protected string _name;
        protected decimal _budgetIncome;
        protected decimal _budgetCost;
        protected DateTime _startDate;
        protected DateTime _endDate;
        protected string _remark;
        protected Corporation _corporation;
        protected IList<Receivables> _receivableses;
        protected IList<PurchaseOrder> _purchaseOrders;
        protected IList<PurchaseReturn> _purchaseReturns;
        protected IList<Sale> _sales;
        protected IList<SalesReturn> _salesReturns;
        protected IList<StockInOut> _stockIns;
        protected IList<StockOutApply> _stockOutApplies;

        #endregion

        #region Constructors

        public Project() { }

        public Project(string name, decimal budgetIncome, decimal budgetCost, DateTime startDate, DateTime endDate, string remark, DateTime createDate, DateTime modifyDate, int editUser, Corporation corporation)
        {
            this._name = name;
            this._budgetIncome = budgetIncome;
            this._budgetCost = budgetCost;
            this._startDate = startDate;
            this._endDate = endDate;
            this._remark = remark;
            this._createDate = createDate;
            this._modifyDate = modifyDate;
            this._editUser = editUser;
            this._corporation = corporation;
        }

        #endregion

        #region Public Properties


        public virtual string Name
        {
            get { return _name; }
            set
            {
                if (value != null && value.Length > 100)
                    throw new ArgumentOutOfRangeException("Invalid value for Name", value, value.ToString());
                _name = value;
            }
        }

        public virtual decimal BudgetIncome
        {
            get { return _budgetIncome; }
            set { _budgetIncome = value; }
        }

        public virtual decimal BudgetCost
        {
            get { return _budgetCost; }
            set { _budgetCost = value; }
        }

        public virtual DateTime StartDate
        {
            get { return _startDate; }
            set { _startDate = value; }
        }

        public virtual DateTime EndDate
        {
            get { return _endDate; }
            set { _endDate = value; }
        }

        public virtual string Remark
        {
            get { return _remark; }
            set
            {
                _remark = value;
            }
        }

        public virtual Corporation Corporation
        {
            get { return _corporation; }
            set { _corporation = value; }
        }

        public virtual IList<Receivables> Receivableses
        {
            get
            {
                if (_receivableses == null)
                {
                    _receivableses = new List<Receivables>();
                }
                return _receivableses;
            }
            set { _receivableses = value; }
        }

        public virtual IList<PurchaseOrder> PurchaseOrders
        {
            get
            {
                if (_purchaseOrders == null)
                {
                    _purchaseOrders = new List<PurchaseOrder>();
                }
                return _purchaseOrders;
            }
            set { _purchaseOrders = value; }
        }

        public virtual IList<PurchaseReturn> PurchaseReturns
        {
            get
            {
                if (_purchaseReturns == null)
                {
                    _purchaseReturns = new List<PurchaseReturn>();
                }
                return _purchaseReturns;
            }
            set { _purchaseReturns = value; }
        }

        public virtual IList<Sale> Sales
        {
            get
            {
                if (_sales == null)
                {
                    _sales = new List<Sale>();
                }
                return _sales;
            }
            set { _sales = value; }
        }

        public virtual IList<SalesReturn> SalesReturns
        {
            get
            {
                if (_salesReturns == null)
                {
                    _salesReturns = new List<SalesReturn>();
                }
                return _salesReturns;
            }
            set { _salesReturns = value; }
        }

        public virtual IList<StockInOut> StockIns
        {
            get
            {
                if (_stockIns == null)
                {
                    _stockIns = new List<StockInOut>();
                }
                return _stockIns;
            }
            set { _stockIns = value; }
        }

        public virtual IList<StockOutApply> StockOutApplies
        {
            get
            {
                if (_stockOutApplies == null)
                {
                    _stockOutApplies = new List<StockOutApply>();
                }
                return _stockOutApplies;
            }
            set { _stockOutApplies = value; }
        }



        #endregion
    }
    #endregion
}